package top.aicats.blog.BlogManage.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.aicats.blog.BlogManage.mapper.MainBlogTypeMapper;
import top.aicats.blog.BlogManage.model.BlogMainType;

import java.sql.Timestamp;
import java.util.List;
import java.util.UUID;

/**
 * @author sjc
 * @version 1.0
 * @date 2020/1/7 21:07
 * @email 952491025@qq.com
 */
@Service
public class MainBlogTypeImpl implements IMainBlogTypeService {

    @Autowired
    MainBlogTypeMapper mainBlogTypeMapper;

    public int addOneMainBlogType(BlogMainType type) {
        type.setBlogMainTypeRefid(UUID.randomUUID().toString().replaceAll("-", ""));
        type.setCreateTime(new Timestamp(System.currentTimeMillis()));
        return mainBlogTypeMapper.insertOneMainType(type);
    }

    @Override
    public List<BlogMainType> getAllMainBlogType() {
        return mainBlogTypeMapper.getAllMainBlogType();
    }

    @Override
    public int deleteMainBlogType(BlogMainType type) {
       return mainBlogTypeMapper.deleteMainBlogType(type);
    }


}
